home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Mac-Source 1994 July
/
Mac-Source_July_1994.iso
/
C and C++
/
Libraries
/
TurboTCP 1.0.1
/
TurboTCP.source
/
CTCPApplication.cp
< prev
next >
Wrap
Text File
|
1993-12-10
|
2KB
|
91 lines
/*
** CTCPApplication.cp
**
** TurboTCP support library
** Application subclass
**
** Copyright © 1993, FrostByte Design / Eric Scouten
**
*/
#include "CTCPApplication.h"
#include "CTCPDriver.h"
// —— startup/shutdown ——
/*______________________________________________________________________
**
** ITCPApplication
**
** Perform standard application initialization. Also opens MacTCP driver and resolver.
**
** extraMasters (short): how many calls to MoreMasters (I recommend
** a higher than usual value here…)
** aRainyDayFund (Size): size of TCL’s “rainy day” fund
** aCriticalBalance (Size): same as for CApplication::IApplication
** aToolboxBalance (Size): same as for CApplication::IApplication
**
*/
void CTCPApplication::ITCPApplication (short extraMasters, Size aRainyDayFund,
Size aCriticalBalance, Size aToolboxBalance)
{
gTCPDriver = NULL;
CApplication::IApplication(extraMasters, aRainyDayFund, aCriticalBalance,
aToolboxBalance);
gTCPDriver = new (CTCPDriver);
gTCPDriver->ITCPDriver(TRUE);
cMaxSleepTime = 90; // don’t want to sleep for very long
// ALSO, must set the “Background Null Events”
// checkbox under Set Project Type…
// (SIZE flags)
}
/*______________________________________________________________________
**
** Quit
**
** Dispose of the TCP driver object.
**
** return (Boolean): TRUE if quit was confirmed by each window
*/
Boolean CTCPApplication::Quit (void)
{
Boolean reallyQuitting;
reallyQuitting = CApplication::Quit();
if (reallyQuitting) {
if (gTCPDriver) // can’t use ForgetObject, since we need the
gTCPDriver->Dispose(); // reference to gTCPDriver to be valid during Dispose
gTCPDriver = NULL;
}
return (reallyQuitting);
}
// —— foreground/background event trapping ——
/*______________________________________________________________________
**
** Process1Event
**
** Here we tap into the event loop to process TCP completions and notifications, now freed
** from interrupt-level constraints on memory management.
**
*/
void CTCPApplication::Process1Event (void)
{
gTCPDriver->ProcessNetEvents();
CApplication::Process1Event();
}